<?php
class Student{

    // public function __construct(){
    //     echo '这是构造函数<br>';
    // }
    // public function Student() {
    //     echo '这是构造函数<br>';
    // }
    private $name;
    private $sex;
    public function  __construct($name,$sex) {
        $this->name=$name;
        $this->sex=$sex;
    }
    //显示信息
    public function show() {
        echo "姓名: {$this->name}<br>";
        echo "性别: {$this->sex}<br>";
    }
}
//实例化
$stu=new Student('tom','男');
$stu->show();
// new Student(); //这是构造函数
// new Student(); //这是构造函数



?>